<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>教师管理平台 - 析码无界</title>
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <script src="http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
    <style>
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background-color: #f5f5f5;
        }
        .navbar {
            border-radius: 0;
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            border: none;
        }
        .navbar-brand {
            color: white !important;
            font-weight: bold;
        }
        .navbar-nav > li > a {
            color: rgba(255,255,255,0.9) !important;
        }
        .navbar-nav > li > a:hover {
            color: white !important;
            background-color: rgba(255,255,255,0.1) !important;
        }
        .navbar-nav > .active > a {
            background-color: rgba(255,255,255,0.2) !important;
            color: white !important;
        }
        .main-content {
            margin-top: 20px;
            min-height: calc(100vh - 100px);
        }
        .panel {
            border: none;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            border-radius: 8px;
        }
        .panel-heading {
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 8px 8px 0 0;
            padding: 15px 20px;
        }
        .panel-title {
            font-size: 18px;
            font-weight: 600;
        }
        .btn-primary {
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            border: none;
        }
        .btn-primary:hover {
            background: linear-gradient(90deg, #5568d3 0%, #653a91 100%);
        }
        .table {
            background: white;
        }
        .table thead {
            background-color: #f8f9fa;
        }
        .form-control:focus {
            border-color: #667eea;
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
        }
        .alert {
            border-radius: 6px;
        }
        .badge {
            padding: 5px 10px;
            border-radius: 12px;
        }
        .badge-published {
            background-color: #5cb85c;
        }
        .badge-grading {
            background-color: #f0ad4e;
        }
        .badge-finished {
            background-color: #5bc0de;
        }
        .avatar-container {
            display: inline-block;
            margin-right: 10px;
            vertical-align: middle;
        }
        .teacher-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: 2px solid rgba(255,255,255,0.8);
            object-fit: cover;
            cursor: pointer;
            transition: transform 0.2s;
        }
        .teacher-avatar:hover {
            transform: scale(1.1);
        }
        .navbar-brand {
            display: flex;
            align-items: center;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="#" th:href="@{/teacher}">
                    <div class="avatar-container">
                        <img th:src="${session.teacher?.avatar != null and !session.teacher.avatar.isEmpty() ? '/' + session.teacher.avatar : ''}" 
                             class="teacher-avatar"
                             th:onclick="'location.href=\'' + @{/teacher/settings} + '\''"
                             onerror="if(this.src.indexOf('data:image') === -1) { this.onerror=null; this.src=''; }"
                             alt="头像">
                    </div>
                    <span><i class="fa fa-graduation-cap"></i> 析码无界 - 教师管理平台</span>
                </a>
            </div>
            <ul class="nav navbar-nav">
                <li><a th:href="@{/teacher/profile}">个人信息</a></li>
                <li><a th:href="@{/teacher/settings}"><i class="fa fa-cog"></i> 设置</a></li>
                <li><a th:href="@{/ppt/list}"><i class="fa fa-file-powerpoint-o"></i> 授课</a></li>
                <li><a th:href="@{/assignment/list}">作业管理</a></li>
                <li><a th:href="@{/class/list}">班级管理</a></li>
                <li><a th:href="@{/teacher/student/list}"><i class="fa fa-list"></i> 学生列表</a></li>
                <li><a th:href="@{/teacher/student/add}"><i class="fa fa-plus"></i> 添加学生</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="/"><i class="fa fa-sign-out"></i> 退出登录</a></li>
            </ul>
        </div>
    </nav>

    <div class="container main-content">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-home"></i> 教师管理主页</h3>
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-md-3">
                        <div class="panel panel-default">
                            <div class="panel-body text-center">
                                <i class="fa fa-user fa-3x" style="color: #667eea;"></i>
                                <h4>个人信息管理</h4>
                                <p>管理您的个人信息</p>
                                <a th:href="@{/teacher/profile}" class="btn btn-primary">进入</a>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="panel panel-default">
                            <div class="panel-body text-center">
                                <i class="fa fa-cog fa-3x" style="color: #667eea;"></i>
                                <h4>设置</h4>
                                <p>修改密码与更换头像</p>
                                <a th:href="@{/teacher/settings}" class="btn btn-primary">进入</a>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="panel panel-default">
                            <div class="panel-body text-center">
                                <i class="fa fa-book fa-3x" style="color: #667eea;"></i>
                                <h4>作业管理</h4>
                                <p>发布、批改作业</p>
                                <a th:href="@{/assignment/list}" class="btn btn-primary">进入</a>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="panel panel-default">
                            <div class="panel-body text-center">
                                <i class="fa fa-users fa-3x" style="color: #667eea;"></i>
                                <h4>班级管理</h4>
                                <p>管理您的班级</p>
                                <a th:href="@{/class/list}" class="btn btn-primary">进入</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row" style="margin-top: 20px;">
                    <div class="col-md-3">
                        <div class="panel panel-default">
                            <div class="panel-body text-center">
                                <i class="fa fa-file-powerpoint-o fa-3x" style="color: #ff6b6b;"></i>
                                <h4>授课</h4>
                                <p>PPT上传与管理</p>
                                <a th:href="@{/ppt/list}" class="btn btn-primary">进入</a>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="panel panel-default">
                            <div class="panel-body text-center">
                                <i class="fa fa-list fa-3x" style="color: #667eea;"></i>
                                <h4>学生列表</h4>
                                <p>查看和管理所有学生信息</p>
                                <a th:href="@{/teacher/student/list}" class="btn btn-primary">进入</a>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="panel panel-default">
                            <div class="panel-body text-center">
                                <i class="fa fa-plus fa-3x" style="color: #667eea;"></i>
                                <h4>添加学生</h4>
                                <p>添加新的学生信息</p>
                                <a th:href="@{/teacher/student/add}" class="btn btn-primary">进入</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 个人信息管理 -->
        <div id="profile-section" class="section" style="display: none;">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-user"></i> 个人信息管理</h3>
                </div>
                <div class="panel-body">
                    <div th:if="${message}" class="alert alert-success" th:text="${message}"></div>
                    <div th:if="${error}" class="alert alert-danger" th:text="${error}"></div>
                    
                    <form th:action="@{/teacher/updateProfile}" method="post" class="form-horizontal">
                        <input type="hidden" th:value="${teacher?.id}" name="id"/>
                        <input type="hidden" th:value="${teacher?.userId}" name="userId"/>
                        
                        <div class="form-group">
                            <label class="col-sm-2 control-label">真实姓名</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="realName" 
                                       th:value="${teacher?.realName}" placeholder="请输入真实姓名">
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-2 control-label">性别</label>
                            <div class="col-sm-10">
                                <select class="form-control" name="gender">
                                    <option value="">请选择</option>
                                    <option value="男" th:selected="${teacher?.gender == '男'}">男</option>
                                    <option value="女" th:selected="${teacher?.gender == '女'}">女</option>
                                </select>
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-2 control-label">所属学院</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="college" 
                                       th:value="${teacher?.college}" placeholder="请输入所属学院">
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-2 control-label">电话</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="phone" 
                                       th:value="${teacher?.phone}" placeholder="请输入电话号码">
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-2 control-label">邮箱</label>
                            <div class="col-sm-10">
                                <input type="email" class="form-control" name="email" 
                                       th:value="${teacher?.email}" placeholder="请输入邮箱地址">
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-2 control-label">专业</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="major" 
                                       th:value="${teacher?.major}" placeholder="请输入专业">
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-2 control-label">职务简介</label>
                            <div class="col-sm-10">
                                <textarea class="form-control" name="jobDescription" rows="4" 
                                          th:text="${teacher?.jobDescription}" placeholder="请输入职务简介"></textarea>
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-save"></i> 保存信息
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <!-- 修改密码 -->
        <div id="password-section" class="section" style="display: none;">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-lock"></i> 修改密码</h3>
                </div>
                <div class="panel-body">
                    <div th:if="${message}" class="alert alert-success" th:text="${message}"></div>
                    <div th:if="${error}" class="alert alert-danger" th:text="${error}"></div>
                    
                    <form th:action="@{/teacher/changePassword}" method="post" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">旧密码</label>
                            <div class="col-sm-10">
                                <input type="password" class="form-control" name="oldPassword" 
                                       placeholder="请输入旧密码" required>
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-2 control-label">新密码</label>
                            <div class="col-sm-10">
                                <input type="password" class="form-control" name="newPassword" 
                                       placeholder="请输入新密码" required>
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-2 control-label">确认新密码</label>
                            <div class="col-sm-10">
                                <input type="password" class="form-control" id="confirmPassword" 
                                       placeholder="请再次输入新密码" required>
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-key"></i> 修改密码
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <!-- 作业管理 -->
        <div id="assignment-section" class="section" style="display: none;">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-book"></i> 作业管理</h3>
                </div>
                <div class="panel-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#publish-tab" data-toggle="tab">发布作业</a></li>
                        <li><a href="#grading-tab" data-toggle="tab">批改作业</a></li>
                        <li><a href="#finished-tab" data-toggle="tab">已结束作业</a></li>
                    </ul>
                    
                    <div class="tab-content" style="margin-top: 20px;">
                        <!-- 发布作业 -->
                        <div id="publish-tab" class="tab-pane active">
                            <form th:action="@{/assignment/publish}" method="post">
                                <div class="form-group">
                                    <label>作业标题</label>
                                    <input type="text" class="form-control" name="title" required>
                                </div>
                                <div class="form-group">
                                    <label>作业内容</label>
                                    <textarea class="form-control" name="content" rows="5" required></textarea>
                                </div>
                                <div class="form-group">
                                    <label>选择班级</label>
                                    <select class="form-control" name="classId" required>
                                        <option value="">请选择班级</option>
                                        <option th:each="clazz : ${classes}" 
                                                th:value="${clazz.id}" 
                                                th:text="${clazz.className}"></option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>截止时间</label>
                                    <input type="datetime-local" class="form-control" name="deadlineStr" required>
                                </div>
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-paper-plane"></i> 发布作业
                                </button>
                            </form>
                        </div>
                        
                        <!-- 批改作业 -->
                        <div id="grading-tab" class="tab-pane">
                            <a th:href="@{/assignment/grading}" class="btn btn-primary">
                                <i class="fa fa-check-square"></i> 查看待批改作业
                            </a>
                        </div>
                        
                        <!-- 已结束作业 -->
                        <div id="finished-tab" class="tab-pane">
                            <a th:href="@{/assignment/finished}" class="btn btn-primary">
                                <i class="fa fa-history"></i> 查看已结束作业
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 班级管理 -->
        <div id="class-section" class="section" style="display: none;">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-users"></i> 班级管理</h3>
                </div>
                <div class="panel-body">
                    <a th:href="@{/class/add}" class="btn btn-primary" style="margin-bottom: 20px;">
                        <i class="fa fa-plus"></i> 添加班级
                    </a>
                    <a th:href="@{/class/list}" class="btn btn-default" style="margin-bottom: 20px;">
                        <i class="fa fa-list"></i> 查看我的班级
                    </a>
                </div>
            </div>
        </div>
    </div>

</body>
</html>
